home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
bc7free.zip
/
FREE.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-03-26
|
2KB
|
71 lines
' Free.Bas 03-25-90 T.E.M. Use Interrupt under BC 7.x
' -------- Remember to invoke QBX fn /lQBX <-- Note !
'$INCLUDE: 'QBX.BI'
DIM Regs AS RegType
Begin:
Clen% = LEN(COMMAND$)
IF Clen% > 1 THEN GOTO DoCmdTail
DoDefaultDriveOnly:
Regs.ax = &H1900 ' Current drv info: DOS service 19
Interrupt &H21, Regs, Regs
Q.Drive$ = CHR$((Regs.ax AND &HFF) + 65) + ":"
GOSUB Q.GetDiskInfo
GOSUB Q.ReportDiskInfo
SYSTEM
DoCmdTail:
FOR Temp% = 1 TO Clen%
C$ = MID$(COMMAND$, Temp%, 1)
DriveLetter% = INSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZ", C$)
IF DriveLetter% > 0 THEN
Q.Drive$ = C$
GOSUB Q.GetDiskInfo
GOSUB Q.ReportDiskInfo
END IF
NEXT Temp%
SYSTEM
Q.GetDiskInfo:
Regs.ax = &H3600 ' Get Q.Drive$ free disk space
Regs.dx = ASC(UCASE$(Q.Drive$)) - 64
Interrupt &H21, Regs, Regs
Q.BytesPersector% = Regs.cx
Q.SectorsPerCluster% = Regs.ax
IF Regs.dx >= 0 THEN
Q.ClustersTotal% = Regs.dx
ELSE Q.ClustersTotal% = (Regs.dx + 65536)
END IF
IF Regs.dx >= 0 THEN
Q.ClustersAvail% = Regs.bx
ELSE Q.ClustersAvail% = (Regs.bx + 65536)
END IF
Q.ClustersAvail& = ABS(Q.ClustersAvail%) ' Convert to Long Integer
Q.ClustersTotal& = ABS(Q.ClustersTotal%)
Q.BytesPersector& = ABS(Q.BytesPersector%)
Q.SectorsPerCluster& = ABS(Q.SectorsPerCluster%)
Temp& = (Q.BytesPersector& * Q.SectorsPerCluster&)
Q.FreeSpace& = (Temp& * Q.ClustersAvail&)
Q.TotalSpace& = (Temp& * Q.ClustersTotal&)
Q.FreePct& = ((Q.ClustersAvail& * 100) \ Q.ClustersTotal&)
RETURN
'------
Q.ReportDiskInfo:
PRINT "Drive "; Q.Drive$; " has ";
PRINT USING "###,###,###"; Q.FreeSpace&;
PRINT " bytes free (";
PRINT USING "###"; Q.FreePct&;
PRINT " %)"
RETURN
'------